<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="menu" content="assetMenu" />
<meta name="nav" content="0" />
<meta name="acc" content="0" />
<title>工程形象进度</title>
<!--  通用情况下 不引入 js css  表单验证  js 放置到页面中 -->
<%-- ui tabs --%>

<script type="text/javascript"
	src="<c:url value='/ext/ui/jquery-ui-1.8.12.custom.min.js'/>"></script>
<link href="${ctx}/styles/lightness/jquery-ui-1.8.12.custom.css"
	rel="stylesheet" />
<script>
	$(document).ready(function() {
		$("#reportedDate").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				maxDate : '%y-%M-%d',
				dateFmt : 'yyyy-MM-dd'
			});
		});

		$("#inputForm").validate({
			rules : {
				finishinvestmenttotal : {
					required : true,
					number : true
				},
				finishmileagetotal : {
					required : true,
					number : true
				},
				finishInvestmentPercent : {
					required : true,
					number : true,
					max : 100,
					min : 0
				},
				progressPercent : {
					required : true,
					number : true,
					max : 100,
					min : 0
				}
			}
		});
	});

	var i = 1;
	function addFile(divName, fileName) {
		var dv = document.getElementById(divName);
		var file = document.createElement("input");
		file.type = "file";
		file.name = fileName;
		file.id = fileName + i;
		dv.appendChild(file);

		var btn = document.createElement("input");
		btn.type = "button";
		btn.id = btn.name = "btn" + i;
		btn.value = "删除";

		btn.onclick = function() {
			var b = document.getElementById(btn.id);
			dv.removeChild(b.nextSibling);
			dv.removeChild(b.previousSibling);
			dv.removeChild(b);
		}
		dv.appendChild(btn);
		dv.appendChild(document.createElement("BR"));
		i++;
	}
</script>
</head>
<body>
<form action="progressreport!saveUpdate.action" method="post" id="inputForm"
	class='yform' enctype="multipart/form-data">
<div id="caption">
<h6>工程进度</h6>
</div>
<table>
	<tr>
		<td>填报人：</td>
		<td><input type="text" name="reportedperson"
			value="${reportedperson}" /> <c:if test="${fn:length(id)==0 }">
			<input name="projectId" type="hidden" value="${param.projectId}" />
		</c:if> <c:if test="${fn:length(id)!=0 }">
			<input name="projectId" type="hidden" value="${project.id}" />
		</c:if></td>
		<td>填报单位：</td>
		<td><input type="text" name="reportedorg" value="${reportedorg}" />
		</td>
	</tr>
	<tr>
		<td>填报日期：</td>
		<td><input type="text" id="reportedDate" name="reportedDate"
			value="<fmt:formatDate value="${reportedDate}" pattern="yyyy-MM-dd" />" />
		</td>
		<c:if test="${ not empty construction.id}">
		<td>施工合同段：</td>
		<td><input type="text" name="construction0" value="${construction.contractNum}" readonly="readonly" />
		</td>
		</c:if>
	</tr>
<tr>
</tr>
	<tr>
		<td>累计完成投资：</td>
		<td><input name="id" type="hidden" value="${id}" /> <input
			name="signId" type="hidden" value="${signId }" /> <input
			id="finishinvestmenttotal" name="finishinvestmenttotal" type="text"
			value="${finishinvestmenttotal }" /></td>
		<td>累计完成总里程:</td>
		<td><input type="text" id="finishmileagetotal"
			name="finishmileagetotal" value="${finishmileagetotal}" />(公里)</td>
	</tr>
	<tr>
		<td>投资完成率(%)：</td>
		<td><input id="finishInvestmentPercent"
			name="finishInvestmentPercent" type="text"
			value="${finishInvestmentPercent}"></input></td>
		<td>形象进度(%)：</td>
		<td><input id="progressPercent" name="progressPercent"
			type="text" value="${progressPercent}" /></td>
	</tr>

	<tr class="type-text">
		<td>施工进度图：<input type="button" value="添加上传"
			onclick="addFile('sources','upload')" /></td>
		<td colspan="3" id="sources"></td>
	</tr>
	<table>
		<c:if test="${not empty attachmentSet}">
			<h6>已有附件</h6>
			<c:forEach items="${attachmentSet}" var="attachment"
				varStatus="state">
				<tr id="tr${state.index }">
					<td colspan="4"><a title="下载"
						href="${ctx}/servlet/annex?id=${attachment.id}">${attachment.upfileFileName}(${attachment.type})<fmt:formatDate
						value="${attachment.fileTime}" pattern="yyyy-MM-dd" /> </a> <span
						onclick="deleteAttachmentById('${attachment.id}','tr${state.index }')"
						class="delete" title="删除附件"></span></td>
				</tr>
	</table>
	</c:forEach>
	<table>
		</c:if>
		<tr>
			<td>施工进度描述：</td>
			<td colspan="3"><textarea name="scheduledescribe" rows="2">${scheduledescribe}</textarea></td>
		</tr>
		<tr>
			<td>备注：</td>
			<td colspan="3"><textarea name="remark" rows="3">${remark}</textarea></td>
		</tr>
	</table>

	<div class="type-button"><input type="submit" class="submit"
		value="提交" /> <input type="button" value="取消" class="reset"
		onclick="window.close()" /></div>
	</form>
</body>
</html>
